/*******************************************************************************
 * Copyright:   Copyright (c) 2007. Hisilicon Technologies, CO., LTD. 
 * Version:      V300R001B866
 * Filename:    AcodecUserCtrl.h
 * Description: Audio driver codec head file
 * History:
                1.Created by Richard(55798) on 2008/12/17
                2.Date: 2008-12-22 11:30
                  Author: H55798
                  Issue Number: AT4D02739
                  Modification: Add user codec control module;
                3.Date: 2009-2-24 20:12
                  Author: H55798
                  Issue Number: AT4D03153
                  Modification: Headset unpop control circuit control;
                4.Date: 2009-7-28 14:18
                  Author: H55798
                  Issue Number: AT4D03923
                  Modification: Speaker phone recharge issue; 
*******************************************************************************/

#ifndef __ACODECUSERCTRL_H__
#define __ACODECUSERCTRL_H__

#include <windows.h>
#include <dbgapi.h>
#include <ceddk.h>


#include "AcodecBase.h"

//==========================================================================
// [define] Debug message
//==========================
extern DWORD g_dwWaveLogMask;

#define WAVEDRV_ERROR               (0x0001)    // Error Msg
#define WAVEDRV_ACODECUSERCTRL      (0x1000)    // Audio codec user control messages

#ifdef SHIP_BUILD
#define ACodecDbgPrintf(printf_exp) ((void)0)
#else
#define ACodecDbgPrintf(printf_exp)  RETAILMSG(0, printf_exp)
#endif
#define ACodecErrorPrintf(printf_exp) NKDbgPrintfW printf_exp

#define K3ACodecMsg(cmd, printf_exp)  \
        (((g_dwWaveLogMask)&(cmd))?(NKDbgPrintfW printf_exp),1:0)
//==========================================================================


//==========================================================================
// [define] User define the default value
//==========================
#define ACODEC_DEFAULT_COMPENSATEGAIN       (0x000F0F0F)

#define ACODEC_USR_DEFAULT_WAVEDACV         (ACODEC_DEFAULT_WAVEDACV)
#define ACODEC_USR_DEFAULT_CALLRECVSPKHSV   (ACODEC_DEFAULT_CALLRECVSPKHSV)
#define ACODEC_USR_DEFAULT_WAVERECVSPKHSV   (ACODEC_DEFAULT_WAVERECVSPKHSV)
#define ACODEC_USR_DEFAULT_CALLUPLINKSIDEV  (ACODEC_DEFAULT_CALLUPLINKSIDEV)
#define ACODEC_USR_DEFAULT_CALLMICBSTAMPV   (ACODEC_DEFAULT_CALLMICBSTAMPV)
#define ACODEC_USR_DEFAULT_RECBST2ADCV      (ACODEC_DEFAULT_RECBST2ADCV)
#define ACODEC_USR_DEFAULT_RECMICBSTAMPV    (ACODEC_DEFAULT_RECMICBSTAMPV)
#define ACODEC_USR_DEFAULT_CALLBTDACADCV    (ACODEC_DEFAULT_CALLBTDACADCV)
#define ACODEC_USR_DEFAULT_COMPENSATEGAIN   (ACODEC_DEFAULT_COMPENSATEGAIN)
//==========================================================================


//==========================================================================
// [class] Define phone linein/lineout volume map struct
//==========================
class ACODECUSERCTRL
{
public:
    ACODECUSERCTRL();
    ~ACODECUSERCTRL();
    
    DWORD GetSpeakerOuputProfile(VOID) const;
    DWORD SetSpkExternalHwPA(IN BOOL bSetup, IN UCHAR ucLspEPA, IN UCHAR ucLoEPA) const;
    BOOL  EnableRegistryVolumeCtrl(VOID) const;
    DWORD GetDefaultCodecPgaVolume(OUT CODEC6421VOLUMEMAP * const pdwVol, IN DWORD dwSize) const;
    DWORD GetDefaultCompensateVolStep(VOID) const;
    DWORD GetPgaVolRampProfile(OUT CODECRAMPPGAVOL * const pdwVol, IN DWORD dwSize) const;
    DWORD GetCodecRegTraceProfile(VOID) const;
    DWORD HeadsetUnpopCircuitPower(IN DWORD dwEvent, IN BOOL bPower);
    DWORD HeadsetUnpopCircuitSwitch(IN DWORD dwEvent, IN BOOL bOpen);
    BOOL GetCallSidetoneSetting(IN EONGOINGCALLST eSt) const;

private:
    ESPEAKEROUTPROFILE m_eSpkProfile;
    BOOL m_bRegVolCtrl;
    DWORD m_dwCompensateVolStep;
    BOOL m_bEnCallSidetone[ONGOINGCALLSIDEOBJ];
    
};
//==========================================================================

#endif  // __ACODECUSERCTRL_H__

